package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.project.api.apis.BusinessModelApi;
import com.nbsaas.boot.project.data.entity.BusinessModel;
import com.nbsaas.boot.project.api.domain.request.BusinessModelRequest;
import com.nbsaas.boot.project.api.domain.response.BusinessModelResponse;
import com.nbsaas.boot.project.api.domain.simple.BusinessModelSimple;
import com.nbsaas.boot.project.rest.convert.BusinessModelSimpleConvert;
import com.nbsaas.boot.project.rest.convert.BusinessModelEntityConvert;
import com.nbsaas.boot.project.rest.convert.BusinessModelResponseConvert;
import com.nbsaas.boot.project.data.repository.BusinessModelRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   业务接口实现
*/
@Transactional
@Service
public class BusinessModelResource extends BaseResource<BusinessModel,BusinessModelResponse, BusinessModelSimple, BusinessModelRequest>  implements BusinessModelApi {

    @Resource
    private BusinessModelRepository businessModelRepository;

    @Override
    public JpaRepositoryImplementation<BusinessModel, Serializable> getJpaRepository() {
        return businessModelRepository;
    }

    @Override
    public Function<BusinessModel, BusinessModelSimple> getConvertSimple() {
        return new BusinessModelSimpleConvert();
    }

    @Override
    public Function<BusinessModelRequest, BusinessModel> getConvertForm() {
        return new BusinessModelEntityConvert();
    }

    @Override
    public Function<BusinessModel, BusinessModelResponse> getConvertResponse() {
        return new BusinessModelResponseConvert();
    }




}


